<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        
.bg-black {
  --tw-bg-opacity: 1;
  background-color: rgba(0, 0, 0, var(--tw-bg-opacity))
}
.bg-opacity-0 {
  --tw-bg-opacity: 0
}

.bg-opacity-50 {
  --tw-bg-opacity: 0.5
}
    </style>
</head>
<body>
     <div class="bg-black bg-opacity-50">666666666</div>
    <script>
// var result = "hello".replace(/^|$/g, '#');
// console.log(result); 
// console.log("hello" == "" + "h" + "" + "e" + "" + "l" + "" + "l" + "o" + "");

var result = "123456789".replace(/(?!^)(?=(\d{3})+$)/g, ',')
console.log(result); 
// => "12345,678"
    </script>
</body>
</html>